import request from './request'

// 查询未处理告警
export const getUnhandledAlarms = () => {
  return request({
    url: '/alarm/unhandled',
    method: 'get'
  })
}

// 查询告警列表
export const getAlarmList = (params) => {
  return request({
    url: '/alarm/list',
    method: 'get',
    params
  })
}

// 处理告警
export const handleAlarm = (data) => {
  return request({
    url: '/alarm/handle',
    method: 'post',
    data
  })
}

// 获取告警规则列表
export const getAlarmRules = () => {
  return request({
    url: '/alarm-rule/list',
    method: 'get'
  })
}

// 创建告警规则
export const createAlarmRule = (data) => {
  return request({
    url: '/alarm-rule/create',
    method: 'post',
    data
  })
}

// 更新告警规则
export const updateAlarmRule = (data) => {
  return request({
    url: '/alarm-rule/update',
    method: 'put',
    data
  })
}

// 删除告警规则
export const deleteAlarmRule = (id) => {
  return request({
    url: `/alarm-rule/${id}`,
    method: 'delete'
  })
}

